package temp;

import java.util.Random;

public class Rename {

    public static void main(String[] args) {

        for (int i = 0; i < 10; i++) {


            System.out.println();
            System.out.println();
            System.out.println();
            System.out.println();

            Random random = new Random();

            long t = random.nextInt(201);

            if (t % 2 == 0) {
                t = t + 1;
            }

            long f = t;

            do {

                //如果是奇数
                if (f % 2 == 1) {
                    //System.out.print("   " + f + (f > t ? "(大于)" : ""));
                    //System.out.print("   " + f + "(2^0*" + f + ")");
                    System.out.print("\t" + f);
                    f = f * 3 + 1;
                } else {

                    long w = f;

                    int k = 0;

                    while (true) {
                        if (w % 2 == 0) {
                            k++;
                            w = w / 2;
                        } else {
                            break;
                        }
                    }

                    // System.out.print("   " + f + "(2^" + k + "*" + w + ")");

                    f = f / 2;
                }

                if (f <= 0) {
                    break;
                }
            } while (f != 1);

            System.out.println();
            System.out.println();
            System.out.println();
            System.out.println();

        }

    }

}
